package com.yanqu.road.server.cmd.beautyescort;

import com.yanqu.road.pb.beautyescort.BeautyEscortProto;
import com.yanqu.road.server.GameServer;
import com.yanqu.road.server.cmd.base.AbstractCommand;
import com.yanqu.road.server.command.Cmd;
import com.yanqu.road.server.gameplayer.GamePlayer;
import com.yanqu.road.server.manger.beautyescort.BeautyEscortMgr;
import com.yanqu.road.message.YanQuMessage;
import com.yanqu.road.server.protocol.GameErrorCode;
import com.yanqu.road.server.protocol.Protocol;

@Cmd(code = Protocol.S_BEAUTY_ESCORT_GET_UNION_MEMBER_DATA, desc = "商会榜单贡献")
public class BeautyEscortRankMemberDataCmd extends AbstractCommand {

    BeautyEscortProto.BeautyEscortRankMemberDataReqMsg reqMsg;
    int weekId;
    String unionUid;
    @Override
    public boolean parseData(YanQuMessage packet) throws Exception {
        reqMsg = BeautyEscortProto.BeautyEscortRankMemberDataReqMsg.parseFrom(packet.getBytes());
        weekId = reqMsg.getWeekId();
        unionUid = reqMsg.getUnionUid();
        return true;
    }

    @Override
    public void execute(GamePlayer player, YanQuMessage packet) throws Exception {
        int thisWeekId = BeautyEscortMgr.getThisWeekId();
        int preWeekId = BeautyEscortMgr.getPreWeekId();
        if(thisWeekId != weekId && preWeekId != weekId){
            ret = GameErrorCode.E_REQUEST_ARGUMENT_ERROR;
            return;
        }
        //全部上跨服查看
        player.sendPacket(Protocol.C_BEAUTY_ESCORT_GET_UNION_MEMBER_DATA, reqMsg.toBuilder());
        /*if(GameServer.getInstance().getServerId() != reqMsg.getServerId()){
            //跨服
            player.sendChannelPacket(Protocol.C_BEAUTY_ESCORT_GET_UNION_MEMBER_DATA, reqMsg.toBuilder());
            return;
        }
        BeautyEscortProto.BeautyEscortRankMemberDataRespMsg.Builder respMsg = BeautyEscortProto.BeautyEscortRankMemberDataRespMsg.newBuilder();
        respMsg.addAllData(BeautyEscortMgr.getUnionRankMemberDataTemp(weekId, unionUid));
        respMsg.setRet(0);
        player.sendChannelPacket(Protocol.U_BEAUTY_ESCORT_GET_UNION_MEMBER_DATA, respMsg);*/
    }

    @Override
    public void sendData(GamePlayer player) {

    }
}
